﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;
using Maticsoft.Common;
using System.Drawing;
using LTP.Accounts.Bus;

namespace lcs.Web.Admin.out_storage_detail
{
    public partial class ListCB : Web.Admin.BasePage
    {


        lcs.BLL.out_storage_detail bll = new lcs.BLL.out_storage_detail();
        lcs.BLL.user bu = new BLL.user();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {               
                BindData();                
            }
        }
       
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            BindData();
        }



        #region gridView

        public void BindData()
        {
           

            DataSet ds = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            if (txtKeyword.Text.Trim() != "")
            {
                strWhere.AppendFormat("and material like '%{0}%'", txtKeyword.Text.Trim());
            }
            if (txtdress.Text.Trim() != "")
            {
                strWhere.AppendFormat("and receive_address like '%{0}%'", txtdress.Text.Trim());
            }
            if (txttime.Text.Trim() != "")
            {
                strWhere.AppendFormat(" and useyear='{0}'", txttime.Text.Trim());
            }
            string dep = getdep();
            strWhere.AppendFormat("and equipmentManage ='{0}'", dep);
            ds = bll.GetListMoney(strWhere.ToString());
            gridView.DataSource = ds;
            gridView.DataBind();
        }

        protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gridView.PageIndex = e.NewPageIndex;
            BindData();
        }
        protected void gridView_OnRowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                //e.Row.Cells[0].Text = "<input id='Checkbox2' type='checkbox' onclick='CheckAll()'/><label></label>";
            }
        }
        protected void gridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            e.Row.Attributes.Add("style", "background:#FFF");
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //LinkButton linkbtnDel = (LinkButton)e.Row.FindControl("LinkButton1");
                //linkbtnDel.Attributes.Add("onclick", "return confirm(\"你确认要删除吗\")");

                //object obj1 = DataBinder.Eval(e.Row.DataItem, "Levels");
                //if ((obj1 != null) && ((obj1.ToString() != "")))
                //{
                //    e.Row.Cells[1].Text = obj1.ToString();
                //}

            }
        }

        protected void gridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {


        }
        #endregion

    }
}